<template>
  <div style="display: flex">
    <el-menu default-active="callSummary" class="menu" @select="tab">
      <el-menu-item index="callSummary">通话</el-menu-item>
      <el-menu-item index="webchatSummary">在线客服</el-menu-item>
    </el-menu>
    <keep-alive>
      <div class="summary">
          <component :is="activeName"></component>
      </div>
    </keep-alive>
  </div>
  <!--<el-tabs tab-position="left" v-model="activeName" @tab-click="tab" >-->
    <!--<el-tab-pane label="通话" name="callSummary" class="font"></el-tab-pane>-->
    <!--<el-tab-pane label="在线客服" name="webchatSummary" class="font"></el-tab-pane>-->
  <!--</el-tabs>-->
</template>
<script>
  import callSummary from './callSummary'
  import webchatSummary from './webchatSummary'
  export default {
    name: 'summaryAll',
    data () {
      return {
        licenceType: [],
        activeName: 'callSummary'
      }
    },
    components: {
      callSummary: callSummary,
      webchatSummary: webchatSummary
    },
    props: {
    },
    methods: {
      tab (index) {
        this.activeName = index
      }
    },
    mounted () {
      let response = []
      this.$store.dispatch('queryVersionNum', {})
        .then((res) => {
          if (res && res.success) {
            response = res.uversions
            let Packages = this.$getCache('licenceType')
            for (let i in response) {
              for (let j = 0; j < Packages.length; j++) {
                if (response[i]._id === Packages[j].code_value) {
                  this.licenceType.push({
                    label: Packages[j].code_name,
                    value: response[i].count,
                    label1: `${Packages[j].code_name}licence`,
                    value1: response[i].licenceCount
                  })
                }
              }
            }
          }
        })
    },
    beforeMount () {
    }
  }
</script>
<style lang="stylus" scoped>
  @import '../../../assets/common.styl'
  .menu
    width 100px
    background-color #f0f2f3
  .summary
    height calc(100vh - 93px)
    width calc(100% - 100px)
    overflow-y auto
</style>
